package org.huatek.anders.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.huatek.anders.annotation.RequestLog;
import org.huatek.anders.entity.UserEntity;
import org.huatek.anders.service.DemoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * @author anders
 * @date 2018-11-01 14:29
 **/
@Slf4j
@RestController
public class DemoController {

    @Reference(check = false)
    private DemoService demoService;

    @PostConstruct
    public void init() {
        // 检查服务是否成功发现服务
        System.err.println("demoService:" + demoService);
    }


    @RequestLog("/user/test")
    @PostMapping("/user/test")
    public UserEntity userTest(@RequestBody UserEntity userEntity){
        return userEntity;
    }

}
